//
//  ForgettingViewController.m
//  结伴
//
//  Created by 莫业金 on 16/8/21.
//  Copyright © 2016年 aleven. All rights reserved.
//

#import "ForgettingViewController.h"
#import "MOPickerView.h"
#import "MOAreaModel.h"

@interface ForgettingViewController ()

@property (weak, nonatomic) IBOutlet UITextField *phone;
@property (weak, nonatomic) IBOutlet UITextField *Password;
@property (weak, nonatomic) IBOutlet UITextField *Confirmation;
@property (weak, nonatomic) IBOutlet UIButton *DistrictNumber;

@end

@implementation ForgettingViewController


/**
 *  获取验证码
 */
- (IBAction)ConfirmationButton:(id)sender {
    
    
}

- (IBAction)backVC:(id)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
}
/**
 *  找回
 */
- (IBAction)Retrieving:(id)sender {
    
    
}


- (IBAction)photnButton:(UIButton *)sender {
    
    NSArray *array = [NSArray arrayWithObjects:@"中国 +86",@"香港 +852",@"澳门 +853",@"台湾 +886",@"美国 +001",@"中途岛 +001808",@"夏威夷 +001808",@"威克岛 +001808",@"安圭拉岛 +001809",@"维尔京群岛 +001809",@"圣卢西亚 +001809",@"波多黎各 +001809",@"牙买加 +001809",@"巴哈马 +001809",@"巴巴多斯 +001809",@"阿拉斯加 +001907",@"格陵兰岛 +00299",nil];
    [MOAreaModel shared].array_single = array;
    
    NSLog(@"%@",[MOAreaModel shared].array_single);
    MOPickerView *views = [MOPickerView showInitWithFrame:CGRectMake(0, 0, 0, 0) PickerViewWithArray:[MOAreaModel shared].array_asingle];
    
    views.title = @"选择区号";
    //自动弹出回复输入
    [views becomeFirstResponder];
    views.backgroundColor = [UIColor lightGrayColor];
    
    typeof(self) weakSelf = self;
    
    views.didChangePickerView = ^(NSMutableArray *arr_text){
        
        
        NSString *str = arr_text[0];
        
        NSArray *array_main = [str componentsSeparatedByString:@" "];
        
        [weakSelf.DistrictNumber setTitle:array_main[1] forState:UIControlStateNormal];
        
    };
    
    [self.view addSubview:views];
    
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    [self.phone setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"]; //改变placeholder提醒语的颜色
    [self.Password setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
    [self.Confirmation setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"qx"] style:UIBarButtonItemStyleDone target:self action:@selector(rightButton:)];
    
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    
     [self.navigationController setNavigationBarHidden:NO animated:YES];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:nil style:UIBarButtonItemStyleDone target:nil action:nil];
    
    
    //让导航栏透明
    UIColor *colorx = [[UIColor colorWithPatternImage:[UIImage imageNamed:@"001"]]colorWithAlphaComponent:0.01];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage cleImage:colorx] forBarMetrics:UIBarMetricsDefault];
    
    
    //    让黑线消失的方法
    self.navigationController.navigationBar.shadowImage=[UIImage new];
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    
    
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
    //设置导航控制器导航上的背景图片，并且拉伸
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navback"] forBarMetrics:UIBarMetricsDefault];
    
    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
                                                         forBarMetrics:UIBarMetricsDefault];
    
    
}


- (void)rightButton:(UIBarButtonItem *)button{
    
    [self.view endEditing:YES];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
